package com.example.myBatisDemo.web.controller;

import com.example.myBatisDemo.web.dao.LiuzhengxingBillBooksMapper;
import com.example.myBatisDemo.web.dataobject.LiuzhengxingBillBooks;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
public class BillBooksController {
    @Autowired
  LiuzhengxingBillBooksMapper liuzhengxingBillBooksMapper;
    @RequestMapping("/add")
    public String add(){
        LiuzhengxingBillBooks liuzhengxingBillBooks=new LiuzhengxingBillBooks();
        liuzhengxingBillBooks.setBillId(50);
        liuzhengxingBillBooks.setBillAmount(100.0);
        liuzhengxingBillBooks.setBillDetailInfo("过路过桥");
        liuzhengxingBillBooks.setBillName("路费");
        liuzhengxingBillBooks.setBillType("支出");
      // liuzhengxingBillBooks.setGmtCreated(new Date());
     //   liuzhengxingBillBooks.setGmtModified(new Date());
        liuzhengxingBillBooks.setStatus(1);
        liuzhengxingBillBooksMapper.insert(liuzhengxingBillBooks);
       return "success";
    }
    @RequestMapping("/list")
    public List<LiuzhengxingBillBooks> list(){
        List<LiuzhengxingBillBooks> res=liuzhengxingBillBooksMapper.selectAll();

        return res;

    }
}
